package com.kehutong.common.filter;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.coraframework.orm.jdbc.execute.DataFilter;

public class FilterFactory {

	private static Map<String, DataFilter> filterMap;
	
	static {
		Map<String, DataFilter> map = new HashMap<>(4);
		
		DataFilter filter = new DataAllFilter();
		map.put(filter.name(), filter);
		
		filter = new OfficeChirldFilter();
		map.put(filter.name(), filter);
		
		filter = new OfficeOnlyFilter();
		map.put(filter.name(), filter);
		
		filterMap = Collections.unmodifiableMap(map);
	}
	
	public static DataFilter getFilter(String key) {
		return filterMap.get(key);
	}
	
	public static DataFilter getRootFilter() {
		return filterMap.get("1");
	}
	
}
